﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SchoolLibrary.Entity;

namespace SchoolLibrary.DataBase.DAO
{
    public class GenreDAO : AbstractDAO<Genre>
    {
        private static GenreDAO instance;

        private GenreDAO() { }

        public static GenreDAO getInstance()
        {
            if (instance == null)
            {
                instance = new GenreDAO();
            }
            return instance;
        }

        public override Genre findById(long id)
        {
            Query classLeaderQuery = new Query(Genre.FIND_BY_ID);
            classLeaderQuery.setParameter("id", id);
            return getDAOHelper().getSingleResult(classLeaderQuery);
        }

        public override List<Genre> findAll()
        {
            Query classLeaderQuery = new Query(Genre.FIND_ALL);
            return getDAOHelper().getResultList(classLeaderQuery);
        }

        public override void save(Genre entity)
        {
            throw new NotImplementedException();
        }
    }
}
